/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package breakupndefmessage;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author emarkki
 */
public class Data {

    
    
    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet 0.3.1**
     * 
     *  URI: http://www.ericsson.com
     *  Certificate: Min User 1 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PSS
     *  Signature present: Yes
     * 
     * 741 bytes
     */
    public static final String msgSpUrlMinUser1SigRSASSAPSS = "files/msgSpUrlMinUser1SigRSASSAPSS.dat";
    
     /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet 0.3.1**
     * 
     *  URI: http://www.ericsson.com
     *  Certificate: Min User 1 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PSS
     *  Signature present: Yes
     * 
     * 741 bytes
     */
    public static final String msgSpUrlMinUser1SigRSAPKCS1 = "files/msgSpUrlMinUser1SigRSAPKCS1.dat";
    
    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet 0.3.1**
     * 
     *  URI: http://www.ericsson.com
     *  Certificate: Min User 2 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     * 
     * 789 bytes
     */
    public static final String msgSpUrlMinUser2SigDSA = "files/msgSpUrlMinUser2SigDSA.dat";
    
    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet 0.3.1**
     * 
     *  URI: http://www.ericsson.com
     *  Certificate: Min User 3 (2) (ECDSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: ECDSA
     *  Signature present: Yes
     * 
     * 789 bytes
     */
    public static final String msgSpUrlMinUser3SigECDSA = "files/msgSpUrlMinUser3SigECDSA.dat";

    /**
     * SmartPoster containing URL and Sig using RSASSA-PKCS1.
     * Created using SampleAppAMidlet rev 205
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: A User1 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PKCS1
     *  Signature present: Yes
     *
     * Message[643 bytes, 1 records] {
        Record(Sp, id=, payload=634 bytes) {
                Message[638 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=606 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 2
                                        Signature: 128 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 471 bytes
                                }
                        }
                }
            }
        }
     *  </pre>
     *
     * 643 bytes
     */
    public static final String msgSpUrlAUser1 = "files/spUrlAUser1.ndef";

    /**
     * SmartPoster containing URL and Sig using RSASSA-PKCS1.
     * Created using SampleAppAMidlet rev 205
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: A User2 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PKCS1
     *  Signature present: Yes
     *
     * <pre>
     * Message[510 bytes, 1 records] {
        Record(Sp, id=, payload=501 bytes) {
                Message[505 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=473 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 2
                                        Signature: 64 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 402 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 510 bytes
     */
    public static final String msgSpUrlAUser2 = "files/spUrlAUser2.ndef";



    /**
     * SmartPoster containing URL and Sig using RSASSA-PKCS1.
     * Created using SampleAppAMidlet rev 205
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: A User3 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     *
     * <pre>
     * Message[842 bytes, 1 records] {
        Record(Sp, id=, payload=833 bytes) {
                Message[837 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=805 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 3
                                        Signature: 46 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 752 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 842 bytes
     */
    public static final String msgSpUrlAUser3 = "files/spUrlAUser3.ndef";

    /**
     * SmartPoster containing URL and Sig using RSASSA-PKCS1.
     * Created using SampleAppAMidlet rev 205
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: A User4 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     *
     * <pre>
     * Message[641 bytes, 1 records] {
        Record(Sp, id=, payload=632 bytes) {
                Message[636 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=604 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 3
                                        Signature: 45 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 552 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 641 bytes
     */
    public static final String msgSpUrlAUser4 = "files/spUrlAUser4.ndef";

    /**
     * SmartPoster containing URL and Sig using RSASSA-PSS.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: B User1 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PSS
     *  Signature present: Yes
     *
     * <pre>
     * Message[760 bytes, 1 records] {
        Record(Sp, id=, payload=751 bytes) {
                Message[755 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=723 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 1
                                        Signature: 128 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 588 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 760 bytes
     */
    public static final String msgSpUrlBUser1 = "files/spUrlBUser1.ndef";

    /**
     * SmartPoster containing URL and Sig using RSASSA-PSS.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: B User2 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: RSASSA-PSS
     *  Signature present: Yes
     *
     * <pre>
     *  Message[628 bytes, 1 records] {
        Record(Sp, id=, payload=619 bytes) {
                Message[623 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=591 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 1
                                        Signature: 64 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 520 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 628 bytes
     */
    public static final String msgSpUrlBUser2 = "files/spUrlBUser2.ndef";

    /**
     * SmartPoster containing URL and Sig using ECDSA.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: C User1 (2) (RSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: ECDSA
     *  Signature present: Yes
     *
     * <pre>
     * Message[400 bytes, 1 records] {
        Record(Sp, id=, payload=391 bytes) {
                Message[395 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=363 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 4
                                        Signature: 55 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 301 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 400 bytes
     */
    public static final String msgSpUrlCUser1 = "files/spUrlCUser1.ndef";

    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: D User1 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     *
     * <pre>
     *Message[753 bytes, 1 records] {
        Record(Sp, id=, payload=744 bytes) {
                Message[748 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=716 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 3
                                        Signature: 46 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 663 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 753 bytes
     */
    public static final String msgSpUrlDUser1 = "files/spUrlDUser1.ndef";
    
    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: D User2 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     *
     * <pre>
     * Message[461 bytes, 1 records] {
        Record(Sp, id=, payload=452 bytes) {
                Message[456 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=424 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 3
                                        Signature: 46 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 371 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 461 bytes
     */
    public static final String msgSpUrlDUser2 = "files/spUrlDUser2.ndef";

    /**
     * SmartPoster containing URL and Sig using DSA.
     * Created using SampleAppAMidlet rev 206
     * <pre>
     *  URI: http://www.ericsson.com
     *  Certificate: D User3 (2) (DSA)
     *  Certificate chain present: Yes
     *  Signature algorithm: DSA
     *  Signature present: Yes
     *
     * <pre>
     * Message[391 bytes, 1 records] {
        Record(Sp, id=, payload=382 bytes) {
                Message[386 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=354 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 3
                                        Signature: 46 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 301 bytes
                                }
                        }
                }
            }
        }
     * </pre>
     *
     * 391 bytes
     */
    public static final String msgSpUrlDUser3 = "files/spUrlDUser3.ndef";


    /**
     * 
     * <pre>
     * Message[392 bytes, 1 records] {
        Record(Sp, id=, payload=383 bytes) {
                Message[387 bytes, 2 records] {
                        Record(U, id=00000001 , payload=13 bytes) {
                                http://www.ericsson.com
                        }
                        Record(Sig, id=, payload=355 bytes) {
                                Version: 1
                                Marker: false
                                Signature Field {
                                        Type: 4
                                        Signature: 56 bytes
                                }
                                Certificate Field {
                                        Format: 0
                                        URI: null
                                        Chain: 292 bytes
                                }
                        }
                }
            }
        }
      </pre>
     *
     * 392 bytes
     */
    public static final String msgSpUrlDUser4 = "files/spUrlDUser4.ndef";


    public static byte[] readBinaryFile(String fileName) throws IOException {
            
        InputStream in = Data.class.getResourceAsStream(fileName);

        if(in == null) {
            throw new IOException("No such file: " + fileName); // Note: Do not obfuscate this class!
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream(1024);

        byte[] buffer = new byte[512];

        int ch;
        while ((ch = in.read(buffer)) > 0) {
            out.write(buffer, 0, ch);
        }
        in.close();

        return out.toByteArray();
    }
    
}
